<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>优惠券管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/mom/coupon/">优惠券列表</a></li>
		<shiro:hasPermission name="sys:role:edit"><li><a href="${ctx}/mom/coupon/form">添加优惠券</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="coupon" action="${ctx}/mom/coupon/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>手机号 ：</label><form:input path="mobile" htmlEscape="false" maxlength="50" class="input-medium"/>
		<label>券号码 ：</label><form:input path="number" htmlEscape="false" maxlength="50" class="input-medium"/>
		<label class="control-label" style="margin-top:3px;">开始时间:</label>
				
					<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
					<input id="createTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${coupon.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>  
<label class="control-label" style="margin-top:3px;">结束时间:</label>
					<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${coupon.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
						<br><br>
		<label>状&nbsp;&nbsp;&nbsp;态  ：
		</label><form:select path="status"  class="input-medium">
			<option selected="selected" value="">全部</option>
			<option value="1">已核销</option>
			<option value="0">未使用</option>
		</form:select>	
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr> 
		<shiro:hasPermission name="sys:user:edit"><th>所属商家</th></shiro:hasPermission>
		<th>姓名</th>
		<th>手机号</th><th>名称</th><th>状态</th><th>有效时间</th><th>核销时间</th><shiro:hasPermission name="momarketing:coupon:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="coupon">
			<tr>
				<shiro:hasPermission name="sys:user:edit"><td>${coupon.user.name}</td></shiro:hasPermission>
				<td title="${coupon.number}">${coupon.member.name}   </td>
				<td>${coupon.mobile}</td>
				<td>${coupon.name}</td>
				<td title="${coupon.remarks }"><c:if test="${coupon.status == 1 }">已核销</c:if><c:if test="${coupon.status == 0 }">未使用</c:if> </td>
				<td>${coupon.createTime}</br>${coupon.endTime}</td>
				<td title="${coupon.remarks }">${coupon.updateTime}</td>
				<shiro:hasPermission name="momarketing:coupon:edit"><td>
					<a href="${ctx}/mom/coupon/delete?id=${coupon.id}" onclick="return confirmx('确认要作废该优惠券吗？', this.href)" class="btn btn-danger">作废</a>
					<c:if test="${coupon.status eq 0 }">
						<a href="${ctx}/mom/coupon/cancel?id=${coupon.id}" onclick="return confirmx('确认要核销该优惠券吗？', this.href)" class="btn btn-success">核销</a>
					</c:if>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
